package com.banana.manager.forest.controller.handle;

import com.banana.manager.forest.entity.handle.PhdBean;
import com.banana.manager.forest.service.impl.handle.PhdServiceImpl;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


@RestController
@RequestMapping("/phd")
public class PhdController {

    @Resource
    private PhdServiceImpl phdService;

    @PostMapping("/addPhd")
    public PhdBean addPhd(@RequestBody PhdBean phdBean) {
        return phdService.addPhd(phdBean);
    }

    @GetMapping("/showPhd")
    public PhdBean showOnePhd(Integer phdId) {
        return phdService.findById(phdId);
    }

    @PostMapping("/updatePhd")
    public PhdBean updatePhd(@RequestBody PhdBean phdBean) {
        return phdService.modifyPhd(phdBean);
    }

    @GetMapping("/deletePhd")
    public void deletePhd(Integer phdId) {
        phdService.deletePhd(phdId);
    }

    @GetMapping("/displayPhd")
    public PageInfo<PhdBean> getPhdPage(Integer page, String phdName, String phdType, String phdDepartment) {
        return phdService.findBlurPage(page, phdName, phdType, phdDepartment);
    }

    @GetMapping("/getAllPhd")
    public List<PhdBean> getAllPhd() {
        return phdService.getAllPhd();
    }
}


